#include "ParticleSignalLine1.h"

#include "ParticleContext.h"
#include "DescriptorParticle.h"

#//include "StreamBinary.h"

using namespace ParticleEngine; 

const DescriptorParticle ParticleSignalLine1::Descriptor
(
	"SignalLine1", 
	[](ParticleContext& NewContext) { return new ParticleSignalLine1(NewContext); }
); 

ParticleSignalLine1::ParticleSignalLine1(ParticleContext& NewContext) :
ParticleBase(NewContext, &ParticleSignalLine1::Descriptor),
PropertyAdhesions(0.15f),
Heat(0.5f)
{
	this->Adhesions = dynamic_cast<PropertyAdhesions*>(this);
	this->Adhesions->ParticleCast = dynamic_cast<ParticleBase*>(this);
}
ParticleSignalLine1::~ParticleSignalLine1()
{
}

void ParticleSignalLine1::Sole()//einzelne aktualisierzung
{
	this->SoleStandard();

	this->Heat.Sole();
	this->Signal1.Sole();
}
void ParticleSignalLine1::InteractionIndividual(ParticleBase*const Other, Vec<2, float>& Space, const float& DistanceSquared)
{
	this->InteractionKinetics(Other, Space, DistanceSquared);

	this->Heat.Interaction(Other->HasHeat());
	this->Signal1.Interaction(Other->HasSignal1());
}

ColorRGBA<unsigned char> ParticleSignalLine1::GetColor()
{
	switch (Signal1.Current)
	{
	case SignalStatus::Awaiting:
		return ColorRGBA<unsigned char> (50, 150, 50, 255);
		break;

	case SignalStatus::Active:
		return ColorRGBA<unsigned char> (50, 255, 50, 255);
		break;

	case SignalStatus::Inactive:
		return ColorRGBA<unsigned char> (10, 70, 10, 255);
		break;
	};
	return ColorRGBA<unsigned char> (255, 255, 255, 255);
}


void ParticleSignalLine1::SaveIndividual(std::ofstream& Strm)
{
	Heat.Save(Strm);
	Signal1.Save(Strm);
}
void ParticleSignalLine1::LoadIndividual(std::ifstream& Strm)
{
	Heat.Load(Strm);
	Signal1.Load(Strm);
}


